//
//  Baike2ViewController.m
//  A段项目
//
//  Created by 月月 on 15/4/14.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "Baike2ViewController.h"

@interface Baike2ViewController ()<UIScrollViewDelegate>

{
    UIScrollView *_scroll;
}


@end

@implementation Baike2ViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.view setBackgroundColor:[UIColor whiteColor]];
    
    [self createScroll];
    
    [self createLabel];
    
}

-(void)createScroll
{
    _scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 64)];
    [_scroll setBounces:NO];
    [_scroll setPagingEnabled:YES];
    _scroll.delegate = self;
    [self.view addSubview:_scroll];
    [_scroll release];
}

-(void)createLabel
{
    NSString *connect1 = @"                机械表该如何保养？\n               May 20, 2013\n     机械表是极为精密的构造产物，对于中高档机械表来说，除了每1、2年的专业养护外，日常佩戴中也应该遵守一些注意事项，才可以避免不必要的损伤。\n        1.防潮\n     尽管大部分腕表都有防水胶圈，但是经年累月，胶圈总会老化，可以的话，每5年就将表送到代理维修，检查和更换防水胶圈。\n    任何时候都要避免让机械表接触到水，千万要避免佩戴潜水表蒸桑拿，因为水汽才是最可怕的锈蚀机芯的源头。\n  越复杂的表防水性能就越差，所以请一定不要尝试你腕表的防水性能。\n            2.防震\n     腕表的摆轮是最怕震动冲击的部分，一定要避免将表从高处摔落，一般机芯的防震系统只能承受普通的摇晃和碰撞，剧烈运动中一定要避免佩戴机械腕表。\n     例如，千万不要带着陀飞轮去打高尔夫。\n       3.保持准时\n       即便是自动上链表，很久不带的话，也要先手动上链，这样才可以保证发条游丝有足够的动力让摆轮正常摆动。\n     防磁也是很重要的一点，尤其是那些并未使用防磁游丝的机械表，要避免放在功放、音响、电视机上，以免磁化，降低游丝的扩张幅度，影响摆轮的摆幅。";
    
    NSDictionary *dit = @{NSFontAttributeName:[UIFont systemFontOfSize:17.0f]};
    CGRect rect = [connect1 boundingRectWithSize:CGSizeMake(_scroll.frame.size.width - 20, 1000000) options:NSStringDrawingUsesLineFragmentOrigin attributes:dit context:nil];
    UILabel *content = [[[UILabel alloc] initWithFrame:CGRectMake(10, 10, _scroll.frame.size.width - 20 , rect.size.height )] autorelease];
    content.numberOfLines = 0;
    content.text = connect1;
    [_scroll addSubview:content];
    _scroll.contentSize = CGSizeMake(0, rect.size.height + 20);
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
